<template>
  <div>
    <web-view :src="outLink"></web-view>
  </div>  
</template>

<script>
export default {
data () {
    return {
      outLink: '',
      count:0
    }
},
onLoad (option) {
    const host = process.env.WEB_BASE_URL
    const mallHost = process.env.MALL_BASE_URL
    const teacherData = JSON.parse(wx.getStorageSync('teacherData'))
    let userTypes = teacherData.userType 
    let loginStr ='?userType='+userTypes + '&mini_token=' + wx.getStorageSync('tokens') + '&userId=' + teacherData.userId + '&userArea=' + wx.getStorageSync('userArea') + '&userVoId=' + teacherData.userVoId
    // if(this.count>1){
        // loginStr = '?from=smallProgram'
    // }
   if (option.type === 'video') {
      this.outLink = decodeURIComponent(option.data)
    } else if (option.type === 'sxCourse') {
      this.outLink = host + '/wx-yxk/#/curriculum/sxCourse' + loginStr
    } else if (option.type === 'yxk') {
      this.outLink = host + '/wx-yxk/#/yxk/univ' +loginStr
    } else if (option.type === 'profession') {
      this.outLink = host + '/wx-yxk/#/professional' +loginStr
    } else if (option.type === 'curriculum') {
      this.outLink = host + '/wx-yxk/#/curriculum/list'+ loginStr
    } else if (option.type === 'curDetail') {
      const data = JSON.parse(option.data)
      this.outLink = host + '/wx-yxk/#/curriculum/detail'+ loginStr+'&id=' + data.id + '&count=' + data.count 
    } else if (option.type === 'service') {
      this.outLink = mallHost + '/home?hide_return_back=true&from=mpwx&sx_token=' + wx.getStorageSync('tokens') + '&sx_uid=' + teacherData.userVoId + '&open_id=' + wx.getStorageSync('openid')
    }else if (option.type === 'infoDetail') {
      this.outLink = host + '/wx-yxk/#/info/infoDetail' + loginStr + '&type=' + option.data
    }else if(option.type==='infoMore'){
        this.outLink = host + '/wx-yxk/#/recruitStudents/news' +loginStr + '&provincesId=' + option.data
    }else if(option.type==='videoMore'){
        this.outLink = host + '/wx-yxk/#/recruitStudents/lives'  + loginStr + '&provincesId=' + option.data
    }else if(option.type==='academyIssueMore'){
         this.outLink = host + '/wx-yxk/#/recruitStudents/consultation'  + loginStr + '&provincesId=' + option.data
    }else if(option.type==='academyIssue'){
         this.outLink = host + '/wx-yxk/#/recruitStudents/academyIssue'+ loginStr + '&type=' + option.data
    }else if (option.type==='topicDetail'){
        this.outLink = host + '/wx-yxk/#/curriculum/detail'+ loginStr + '&id=' + option.data
    }else if (option.type === 'topicMore'){
        this.outLink = host + '/wx-yxk/#/recruitStudents/subjectDetail'+ loginStr + '&type=' + option.data
    }
    console.log(' this.outLink: ',  this.outLink);
    // this.count+=1
  },
}
</script>

<style lang="less" scoped>

</style>
